
package com.mzba.easy.weibo.util;

import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Map;

import android.content.Context;

import com.mzba.easy.weibo.db.EmotionEntry;
import com.mzba.easy.weibo.db.EmotionField;

/**
 * 全局类
 * 
 * @author 06peng
 * 
 */
public class AppContext {
	
	public static final String App_Key = "1958888332";
	public static final String App_Secret = "8ebc459b562fc2b2601e4f5dd3d62b6f";
	public static final String Callback = "http://06peng.com/";
	public static final String Authorize = "https://api.weibo.com/oauth2/authorize?client_id="+App_Key+"" +
			"&response_type=code&redirect_uri=" + Callback;
	public static final String Access_Token = "https://api.weibo.com/oauth2/access_token?client_id="+App_Key+"&client_secret="+App_Secret+"" +
			"&grant_type=authorization_code&redirect_uri="+Callback+"&code=";
	
	/**1代表发表新微博、2代表转发、3代表评论*/
	public static final String NEWTYPE = "new_type";
	public static final int LOCATE_RESULT = 100011;
	

	private static AppContext instance = new AppContext();

	public static AppContext getInstance() {
		if (instance == null) {
			instance = new AppContext();
		}
		return instance;
	}

	public static final String UNAVAILABLE = "unavailable";
	public static final String AVAILABLE = "available";

	/**
	 * 获取 系统上下文
	 */
	private WeakReference<Context> context;

	/**
	 * 获取 系统上下文
	 * 
	 * @return
	 */
	public static Context getContext() {
		if (getInstance().context == null) {
			return null;
		}
		return getInstance().context.get();
	}

	/**
	 * 设置 系统上下文
	 * 
	 * @return
	 */
	public static void setContext(Context contextx) {
		getInstance().context = null;
		getInstance().context = new WeakReference<Context>(contextx);
	}

	private String access_token;
	public void setAccess_token(String access_token) {
		this.access_token = access_token;
	}
	
	public String getAccess_token() {
		return access_token;
	}
	
	private String uid;
	public String getUid() {
		return uid;
	}
	
	public void setUid(String uid) {
		this.uid = uid;
	}
	
	private Map<String, String> faceMap;
	
	private List<EmotionEntry> emotionEntries;
	public void setFaceMap(Map<String, String> faceMap) {
		this.faceMap = faceMap;
	}
	public Map<String, String> getFaceMap() {
		return faceMap;
	}
	
	private List<EmotionField> emotionFields;
	
	public List<EmotionField> getEmotionFields() {
		return emotionFields;
	}

	public void setEmotionFields(List<EmotionField> emotionFields) {
		this.emotionFields = emotionFields;
	}

	public List<EmotionEntry> getEmotionEntries() {
		return emotionEntries;
	}

	public void setEmotionEntries(List<EmotionEntry> emotionEntries) {
		this.emotionEntries = emotionEntries;
	}

	public static final int get_Comment_By_Statusid = 10086;
	
	public static final String SD_PATH = "EasyWeibo";
	/**用户头像图片路径*/
	public static final String USERHEADICON = SD_PATH + "/userhead";
	
	public static final String TEMP_PATH = SD_PATH + "/temp";
	
	public static final String FRIENDSTIMELINE_PATH = SD_PATH + "/friendTimelines";
	public static final String DOWNLOAD_PATH = SD_PATH + "/download";
	
	public static final String friend_timeline = "https://api.weibo.com/2/statuses/friends_timeline.json";
	public static final String get_comments_by_statusid = "https://api.weibo.com/2/comments/show.json";
	public static final String get_user_by_userid = "https://api.weibo.com/2/users/show.json";
	public static final String get_emotions = "https://api.weibo.com/2/emotions.json";
	public static final String comment_status = "https://api.weibo.com/2/comments/create.json";
	public static final String reply_comment = "https://api.weibo.com/2/comments/reply.json";
	public static final String mention_timeline = "https://api.weibo.com/2/statuses/mentions.json";
	public static final String destroy_comment = "https://api.weibo.com/2/comments/destroy.json";
	public static final String get_user_timeline = "https://api.weibo.com/2/statuses/user_timeline.json";
	public static final String get_user_followers = "https://api.weibo.com/2/friendships/followers.json";
	public static final String get_user_friends = "https://api.weibo.com/2/friendships/friends.json";
	public static final String repost = "https://api.weibo.com/2/statuses/repost.json";
	public static final String destroy_status = "https://api.weibo.com/2/statuses/destroy.json";
	public static final String update_status = "https://api.weibo.com/2/statuses/update.json";
	public static final String upload_status = "https://upload.api.weibo.com/2/statuses/upload.json";
	public static final String friend_create = "https://api.weibo.com/2/friendships/create.json";
	public static final String friend_destroy = "https://api.weibo.com/2/friendships/destroy.json";
	public static final String get_favorites = "https://api.weibo.com/2/favorites.json";
	public static final String create_favorite = "https://api.weibo.com/2/favorites/create.json";
	public static final String destroy_favorite = "https://api.weibo.com/2/favorites/destroy.json";
	public static final String comment_timeline_tome = "https://api.weibo.com/2/comments/to_me.json";
	public static final String comment_timeline_byme = "https://api.weibo.com/2/comments/by_me.json";
	public static final String comment_timeline_mentionme = "https://api.weibo.com/2/comments/mentions.json";
	public static final String comment_timeline = "https://api.weibo.com/2/comments/timeline.json";
	
}
